<?php

/**
 * AccountController.class.php 后台权限管理
 * Created Time 2016年3月17日 上午10:02:55
 *
 * @author     codingyuan@163.com
 */
namespace System\Controller;
use System\Common\SystemController;

class AccountController extends SystemController {

    public function __construct()
    {
        parent::__construct();
        $this->system_left_tpl='System@Account/left';
        $this->__getLeftMenu();
    }
    
    public function info()
    {
        
        $this->loadSystemView();
    }
    
    public function editPwd()
    {
        $this->loadSystemView();
    }
    
    
    // 设置左侧菜单
    private function __getLeftMenu()
    {
        $leftArr = array();
        $leftMenu = array();
        $params = array();
        $leftArr = C('menu.left_account_menu');
        $module = 'System';
        $ctl = 'Index';
        $act = 'index';
        
        foreach ($leftArr as $val)
        {
            if($val['display'] && $val['method'] == 'get')
            {
                if(isset($val['params']) && is_array($val['params']))
                {
                    $params = $val['params'];
                }
                
                if(isset($val['module']))
                {
                    $module = $val['module'];
                }
                
                if(isset($val['ctl']))
                {
                    $ctl = $val['ctl'];
                }
                
                if(isset($val['act']))
                {
                    $act = $val['act'];
                }
                $domain = C('domain', null, '');
                $url = sprintf('%s/%s/%s@%s', $module, $ctl, $act, $domain);
                $leftLink['url'] = U($url,$params);
                $leftLink['label'] = isset($val['label']) ? $val['label'] : 'default lable';
                $leftLink['act'] = $act;
                $leftMenu[] = $leftLink;
            }
        }
        
        $this->system_left_menu = $leftMenu;
    }
}